$(function () {
    $('#log-btn').click(function (e) {
        e.preventDefault();
        var username = $('#username').val();
        var password = $('#password').val();
        $.post(
            url = '/login',
            data = {
                'username': username,
                'password': password,
            },
            callback = function (data) {
                if (data['code'] == 200) {
                    window.location = '/';
                } else {
                    alert(data['msg'])
                }
            }
        );
    });
});